import request from '@/utils/request'

// 获取所有的Role
export function getAll() {
  return request({
    url: 'api/role/all',
    method: 'post'
  })
}

export function add(data) {
  return request({
    url: 'api/role/create',
    method: 'post',
    data
  })
}

export function getOne(id) {
  const data = { id: id }
  return request({
    url: 'api/role/one',
    method: 'post',
    data
  })
}

export function del(ids) {
  const data = { ids: ids }
  return request({
    url: 'api/role/delete',
    method: 'post',
    data
  })
}

export function edit(data) {
  return request({
    url: 'api/role/update',
    method: 'post',
    data
  })
}

export function editMenu(data) {
  return request({
    url: 'api/role/bind/menu',
    method: 'post',
    data
  })
}

export default { add, edit, del, getOne, editMenu }
